package com.ylxn.sqlSession;

import java.sql.SQLException;
import java.util.List;

public interface SqlSession {
    /**
     * 查询所有
     * @param <E>
     * @return
     */
    public <E> List<E> selectList(String statementId,Object...params);

    /**
     * 条件查询获取单个
     * @param statementId
     * @param params
     * @param <T>
     * @return
     */
    public <T> T selectOne(String statementId,Object...params);

    /**
     * 新增
     * @param statementId
     * @param params
     * @return
     */
    public int save(String statementId,Object...params) throws SQLException, NoSuchFieldException, IllegalAccessException;

    /**
     * 更新
     * @param statementId
     * @param params
     * @return
     */
    public int update(String statementId,Object...params) throws SQLException, NoSuchFieldException, IllegalAccessException;

    /**
     * 删除
     * @param statementId
     * @param params
     * @return
     */
    public int delete(String statementId,Object...params) throws SQLException, NoSuchFieldException, IllegalAccessException;

    /**
     * 动态生成代理对象
     * @param mapperClass
     * @param <T>
     * @return
     */
    public <T> T getMapper(Class<?> mapperClass);
}
